package cn.legend.travel.tour.team.controller;

import cn.legend.travel.common.web.JsonResult;
import cn.legend.travel.tour.team.pojo.param.OrderInfoParam;
import cn.legend.travel.tour.team.pojo.param.OrderParam;
import cn.legend.travel.tour.team.pojo.po.OrderInfoPO;
import cn.legend.travel.tour.team.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.spring.web.json.Json;

@RestController
@RequestMapping("/tour/order/")
public class OrderController {
    @Autowired
    private IOrderService orderService;

    @PostMapping("create")
    public JsonResult createOrder(@RequestBody OrderParam orderParam){
        orderService.createOrder(orderParam);
        return JsonResult.ok();
    }

    @PostMapping("save")
    public JsonResult saveOrderInfo(@RequestBody OrderInfoParam orderInfoParam){

        orderService.saveOrderInfo(orderInfoParam);
        return JsonResult.ok();
    }
    @GetMapping("get")
    public JsonResult getOrderInfo(@RequestParam("orderNo") String orderNo){

        return JsonResult.ok(orderService.getOrderInfoByOrderNo(orderNo));
    }

}
